//SPDX-FileCopyrightText: Copyright 2022-2024 深圳市同心圆网络有限公司
//SPDX-License-Identifier: GPL-3.0-only

package roadmap_dao

import "go.mongodb.org/mongo-driver/mongo"

var RoadmapInfoDao *_RoadmapInfoDao
var NodeDao *_NodeDao
var EdgeDao *_EdgeDao
var StateDao *_StateDao
var StateOpDao *_StateOpDao
var NodeOpIndexDao *_NodeOpIndexDao
var UserOpIndexDao *_UserOpIndexDao
var AccessRecordDao *_AccessRecordDao
var NoteDao *_NoteDao
var WhiteUserDao *_WhiteUserDao
var TagDao *_TagDao

func InitDao(mgoDb *mongo.Database) (err error) {
	RoadmapInfoDao, err = newRoadmapInfoDao(mgoDb)
	if err != nil {
		return
	}
	NodeDao, err = newNodeDao(mgoDb)
	if err != nil {
		return
	}
	EdgeDao, err = newEdgeDao(mgoDb)
	if err != nil {
		return
	}
	StateDao, err = newStateDao(mgoDb)
	if err != nil {
		return
	}
	StateOpDao, err = newStateOpDao(mgoDb)
	if err != nil {
		return
	}
	NodeOpIndexDao, err = newNodeOpIndexDao(mgoDb)
	if err != nil {
		return
	}
	UserOpIndexDao, err = newUserOpIndexDao(mgoDb)
	if err != nil {
		return
	}
	AccessRecordDao, err = newAccessRecordDao(mgoDb)
	if err != nil {
		return
	}
	NoteDao, err = newNoteDao(mgoDb)
	if err != nil {
		return
	}
	WhiteUserDao, err = newWhiteUserDao(mgoDb)
	if err != nil {
		return
	}
	TagDao, err = newTagDao(mgoDb)
	if err != nil {
		return
	}
	return
}
